package com.tank.jdk8.stream;

import java.util.Collections;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/1/29
 * Time: 20:12
 * To change this template use File | Settings | File Templates.
 */
public class StreamTest6 {

    public static void main(String[] args) {
        //循环流
      //  Stream.iterate(0,item -> (item +1) % 2).distinct().limit(6).forEach(System.out::println);

        //修改为
       // Stream.iterate(0,item -> (item +1) % 2).limit(6).distinct().forEach(System.out::println);

        //peek
        Stream stream = Stream.of(0,1,2,3,4,5);
        stream.peek(item -> System.out.println(item)).collect(Collectors.toList());
    }
}

